package cn.aopmin.order.controller;

import cn.aopmin.order.event.LogEvent;
import cn.hutool.extra.spring.SpringUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

//    @Autowired
//    private ApplicationEventPublisher eventPublisher;

    @RequestMapping("test")
    public String test(String msg) {
        LogEvent logEvent = new LogEvent(this, msg);
        // 发布事件
        //  eventPublisher.publishEvent(logEvent);
        SpringUtil.getApplicationContext().publishEvent(logEvent);
        return "ok";
    }
}